<?php
    $imageData = $_REQUEST['data'];   //get base64 image data as string
    $image = explode('base64,',$imageData);
    $uniqueId = md5(date('Ymdgisu',mktime()));  //generates 32 bit encrypted id
    $target_path = 'uploadimages/' . $uniqueId . '.jpg';
    file_put_contents($target_path, base64_decode($image[1])); //write the file to the location under $target_path

    //$prefix = md5($uniqueId);  //another 32 bit prefix generated from the earlier generated $uniqueId
    $prefix = hash('sha256',$uniqueId);  //generate a 64 bit hash from uniqueID above
?>